package jsyf.oa.entity.wechat.service_company;

import com.alibaba.fastjson.JSONObject;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.Table;

import jsyf.oa.ientity.BaseEntity;

@Entity
@Table(name = "T_WECHAT_ACCESSTOKEN", schema = "oa", catalog = "")
public class TokenEntity extends BaseEntity {

    private String accessToken;
    private Date createTime;
    private int expiresIn;
    /**
     * 0-服务号 2-企业号secret 3-通讯录secret
     */
    private int type;
    private String companyId;


    @Override
    public JSONObject getJSONObject() {
        JSONObject obj = new JSONObject();
        obj.put("ID", id);
        obj.put("ACCESS_TOKEN", accessToken);
        obj.put("CREATE_TIME", createTime);
        obj.put("EXPIRES_IN", expiresIn);
        obj.put("TYPE", type);
        obj.put("COMPANY_ID", companyId);
        return obj;
    }

    @Override
    public String getTableName() {
        return "T_WECHAT_ACCESSTOKEN";
    }

    @Override
    public JSONObject getJSONColumns() {
        JSONObject obj = new JSONObject();
        obj.put("ID", "id");
        obj.put("ACCESS_TOKEN", "accessToken");
        obj.put("CREATE_TIME", "createTime");
        obj.put("EXPIRES_IN", "expiresIn");
        obj.put("COMPANY_ID", "companyId");
        obj.put("TYPE", "type");
        return obj;
    }

    public String getAccessToken() {
        return accessToken;
    }

    public void setAccessToken(String accessToken) {
        this.accessToken = accessToken;
    }

    @Override
    public Date getCreateTime() {
        return createTime;
    }

    @Override
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public int getExpiresIn() {
        return expiresIn;
    }

    public void setExpiresIn(int expiresIn) {
        this.expiresIn = expiresIn;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getCompanyId() {
        return companyId;
    }

    public void setCompanyId(String companyId) {
        this.companyId = companyId;
    }
}
